<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p>什么是数组的遍历？</p>
<p>指的是我们将数组里面的元素全部取出来的行为叫做数据的遍历</p>
</body>
<script type="text/javascript">

    var arr1 = [];
    var arr = ['abc', 'def', 12, 12, true, false, undefined, null];
    // 下标范围：0 - arr.length -1;
    console.log(arr.length);
    console.log(arr[0]);
    console.log(arr[1]);
    console.log(arr[2]);
    console.log(arr[3]);
    console.log(arr[4]);
    console.log(arr[5]);
    console.log(arr[6]);
    console.log(arr[7]);
    // 如果写的下标不在范围之内，会怎么样？ 称之为越界访问，在javascript里面越界访问不会报错！
    // 1. < 0; > arr.length -1;
    console.log(arr[-1], '-1');
    console.log(arr[8], '8');


</script>

</html>
